home *** CD-ROM | disk | FTP | other *** search
- Path: dialup-4.act.apana.org.au!daedelus
- From: Alex Satrapa <daedelus@posgate.apana.org.au>
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel
- Subject: Re: Hungarian notation
- Date: 11 Jan 1996 12:23:45 GMT
- Organization: -
- Distribution: world
- Message-ID: <4d2vgh$f5m@posgate.acis.com.au>
- References: <LQs1wg2yqf9U083yn@iaccess.za> <dewar.819838019@schonberg> <dewar.819838217@schonberg> <E/56wg2yqXwB083yn@iaccess.za>
- NNTP-Posting-Host: dialup-4.act.apana.org.au
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: Nuntius 2.0.4_68K
- X-XXMessage-ID: <AD1B4B4C90015A85@dialup-4.act.apana.org.au>
- X-XXDate: Thu, 11 Jan 1996 06:18:36 GMT
-
- In article <E/56wg2yqXwB083yn@iaccess.za> Vince Risi, vincer@iaccess.za
- writes:
-
- >> > Branch Branch1 = Branches[First];
- >> > Branch Branch2 = Branches[Second];
- >> > // if the branches are of the same kind...
- >> > // ...and the same destination...
- >> > if (KindBranch(Branch1) == KindBranch(Branch2) &&
- >> > DestBranch(Branch1) == DestBranch(Branch2))
- >> > {
- >> > // do something useful with the parallel edges
- >> > ...
- >> > }
-
- I *like* this code! When you read it, it *means* something - look at the
- first
- line - set (branch-type variable) Branch number 1 to the first branch in
- the
- array of Branches.
-
- Check out the if - if the kind of Branch 1 is the same as the kind of
- Branch 2...
-
- In Object Pascal this would be more like
-
- Branch1 := Branches[FIRST];
- Branch2 := Branches[SECOND];
- if (Branch1.kind = Branch2.kind) and
- (Branch1.dest = Branch2.dest) then
- begin
- { Do something useful with the *converging* edges }
- end
-
- Sometimes in procedural Pascal I'll have variables named Variable,
- VariablePtr
- and maybe even VariableH - variable, pointer to variable and handle to
- variable.
-
-
- I saw one guy writing code for Gupta SQL Windows - it was horrible -
- everywhere
- he'd have stuff like bfBlah and giMoose meaning "background field called
- Blah" and
- "Global integer called Moose". What made me so distraught was the fact
- that
- so much of the code was dependent on the *type* of the variable, rather
- than
- the *content*.
-
- As to comments about strings being strings - here are two strings that
- are not
- really strings:
-
- "[123,234,456,567]"
-
- and
-
- "{Cheque,65472,Whistlestop cafe,Fried Green tomatoes,$54.34,12/3/45}"
-
- The first represents a list of numbers that could be of any length. While
- some
- people would like to use pointers, what about storing this arbitrary
- length
- array in human readable form?
-
- The second represents a transaction in a personal accounts system. While a
- record could be used, I would once again use this human-readable form to
- store it in a text file while I'm testing/debugging my program -
- especially
- if I'm doing cross-platform development (eg: big/little endian problems, 8
- versus 16 bit integers, IEEE versus someone else's reals).
-
- In one development cycle, I may prefer to use strings. The next time
- round, I
- decide to change them all to records (mainly to conserve memory). I don't
- want
- to change *every variable name* to indicate that the variable is now a
- record,
- rather than a string.
-
- There... I've expressed my thoughts...
- -Alex
-